<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="public/layui/css/layui.css">
    <link rel="stylesheet" href="public/css/bootstrap.min.css">
    <script src="public/js/jquery-1.11.1.min.js"></script>
    <script src="public/layui/layui.all.js"></script>
    <script src="public/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="public/css/shouye.css">
    <script src="public/js/modernizr-custom-v2.7.1.min.js"></script>
    <title>Document</title>
</head>

<body>
    <div class="head">
        <ul class="head-item-ul">
            {{if username}}
            <li style="float:left;font-size: 30px;line-height: 80px;color: #cccccc;">用户:{{username}}</li>
            {{else}}
            <li style="float:left;font-size: 30px;line-height: 80px;color: #cccccc;">请先登录</li>
            {{/if}}
            <li class="nav-item""><a href=" /login">登录 </a> </li>
            <li class="nav-item"><a href="javascript:void(0);" id="delogin">退出登录</a></li>
            <li class="nav-item"><a href="/card">购物车</a></li>
            <li class="nav-item"><a href="/shopcard">订单</a></li>
            <li class="nav-item"><a href="/index">主页</a></li>
        </ul>
    </div>
    <div class="content">
        {{block 'content'}}{{/block}}
    </div>
    <footer class="bode-foot">
        我的商场@111
    </footer>
    <style>
        * {
            box-sizing: border-box;
            padding: 0px;
            margin: 0px;
        }

        .head {
            background-color: rgb(57, 61, 73);
            width: 100%;
        }

        .head-item-ul {
            margin-bottom: 2px;
            width: 980px;
            margin: 0px auto;
        }

        .head-item-ul {
            overflow: hidden;
            height: 80px;
            background-color: rgb(57, 61, 73);

        }

        .nav-item {
            float: right;
        }

        .nav-item a {
            color: #ffffff;
            height: 80px;
            line-height: 80px;
            font-size: 20px;
            margin: 0px 10px;
            display: block;
            width: 100px;
            text-align: center;
        }

        .nav-item a:hover {
            border-bottom: 5px solid rgb(95, 184, 120);
        }

        .content {
            min-height: 900px;
        }

        .bode-foot {
            height: 100px;
            width: 980px;
            margin: 0px auto;
            /* position: fixed;
            bottom: 0px; */
            text-align: center;
            line-height: 100px;
            background-color: rgb(35, 36, 37);
            color: #eeeeee;
        }
    </style>
    {{block 'contentcss'}}{{/block}}
    <script>
        $(function () {
            $('#delogin').on('click', function () {
                if (confirm('是否退出登录')) {
                    $.ajax({
                        type: "post",
                        url: "/api/dellogin",
                        success: function (res) {
                            if (res.flog) {
                                window.location.href = '/login';
                            } else {
                                layer.msg('退出登录失败!', { icon: 5, time: 1000 });
                            }
                        },
                        error: function (err) {
                            layer.msg('程序异常!', { icon: 5, time: 1000 });
                        }
                    });
                }
            })
        })
    </script>
    {{block 'contentjs'}}{{/block}}
</body>

</html>